import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import get from '@dfeidao/atom-web/local/get';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import refresh from '@dfeidao/atom-web/url/refresh';

export default async function a003(fd: IFeidaoAiBrowserComponent) {
	// 右侧新增保存
	//const d_name = get(fd, 'd_name');
	const nos = get(fd, 'nos');

	const risk_po_name = fd.data.node.querySelector<HTMLInputElement>('[data-id="risk_po_name"]').value;
	if (!risk_po_name) {
		alert('请输入风险点名称');
		return;
	}
	const res = get(fd, 'res');

	const r = await nodejs<{ code: 0 | 1; }>('risk-point/zj-000006/s001', {
		filter: {
			risk_po_name: risk_po_name,
			risk_po_type_no: nos,
			// hidden_source:
			// 	hidden_code:
			// hidden_name:
		}
	});
	console.log(r);
	if (r.code === 1) {
		alert("保存成功");
		refresh();
	} else {
		alert("保存失败");
	}

}
